#include "ReadJoint.hpp"
#include "PlayFinishException.hpp"
#include <filesystem>
#include <stdexcept>

void ReadJoint::Start(std::filesystem::path file)
{
  if(fileobj.is_open())
    fileobj.close();
  fileobj.open(file);
  if(!fileobj.is_open())
    throw std::runtime_error("无法打开文件");
}

ReadJoint& ReadJoint::operator>> (float& value)
{
  fileobj>>value;
  if(fileobj.eof())
    throw PlayFinishException();
  return *this;
}

